package com;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by liuhaibin on 2017/6/20.
 */
public class ProducerImpl implements Producer {
    private static final Logger logger = LoggerFactory.getLogger(ProducerImpl.class);
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void sendDataToQueue(String queueKey, Object object) {
        try {
            amqpTemplate.convertAndSend(queueKey, object);
//            amqpTemplate.convertAndSend(object);
        } catch (Exception e) {
            logger.error(e.getMessage());
        }
    }
}
